'''

setStyle()
QstyleFactory()  当前平台支持的样式
QApplication.setStyle()  设置样式

'''
import sys
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PyQt5.QtGui import *
class AppWidget(QWidget):
    def __init__(self,parent=None):
        super(AppWidget,self).__init__(parent)
        Hlayout=QHBoxLayout()

        self.styleLabel=QLabel('设置样式')
        self.styleComboBox=QComboBox()
        #从QstyleFactory中增加多个显示样式到列表控件
        self.styleComboBox.addItems(QStyleFactory.keys())
        #选择当前的窗口
        index=self.styleComboBox.findText(QApplication.style().objectName(),Qt.MatchFixedString)
        #通过我们的下拉框控件设置窗口布局
        self.styleComboBox.activated[str].connect(self.handChange)
        Hlayout.addWidget(self.styleLabel)
        Hlayout.addWidget(self.styleComboBox)
        self.setLayout(Hlayout)

    def handChange(self,style):
        QApplication.setStyle(style) 
if __name__ == '__main__':
    app=QApplication(sys.argv)
    win=AppWidget()
    win.show()
    sys.exit(app.exec_())